import os
import img2pdf

with open("D://pythonFile/test.pdf","wb") as file:
      print(os.listdir('D://pythonFile'))
      file.write(img2pdf.convert([i for i in os.listdir('D://pythonFile') if i.endswith('.jpg') or i.endswith('.png')]))
